package com.gxa.controller.points;

import com.gxa.common.utils.R;
import com.gxa.common.utils.Result;
import com.gxa.entity.community.UserList;
import com.gxa.entity.points.Integration;
import com.gxa.service.community.UserListService;
import com.gxa.service.points.IntegrationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yjl
 * @since 2022-10-17 10:36:07
 */
@Api(tags = "总积分")
@RestController
@RequestMapping("/integration")
public class IntegrationController {

    @Autowired
    private IntegrationService integrationService;
    @Autowired
    private UserListService userListService;

    @ApiOperation(value = "添加积分表接口")
    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @PostMapping("/add")
    public Result add(@RequestParam("userName")String userName,@RequestParam("typeNumber") Integer typeNumber) {
        System.out.println(userName);
        System.out.println(typeNumber);
       try {
           this.integrationService.add(typeNumber, userName);
           return Result.success("添加成功");
       }catch (Exception e){
           e.printStackTrace();
           return Result.failed("添加失败");
       }
    }
}
